<!DOCTYPE html>
<html>
    <head>
        <title>事件总线测试</title>
        <script src="../../src/event/event-bus.js"></script>
    </head>
    <body>
        <script>
            // eventBus
            eventBus.on('login', data => {
                console.log('用户已登录', data)
            })

            eventBus.on('login', data => {
                console.log('登录数据已写入', data)
            })

            eventBus.on('logout', data => {
                console.log('用户已退出', data)
            })

            console.log(eventBus)

            // 触发
            // setTimeout(() => {
            //     eventBus.emit('login', "张三")
            // }, 1000)

            eventBus.off('login')

            console.log(eventBus)
        </script>
    </body>
</html>